﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Ramp.Service.Contract;

namespace Ramp.Service
{
    /// <summary>
    /// This WCF Service instantiates a type of IRampService proxy singleton object.
    /// </summary>
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
    public class RampService : IRampService
    {
        /// <summary>
        /// This member variable holds a value indicating whether a load test is currently running or not.
        /// </summary>
        private bool loadTestStatus = false;

        /// <summary>
        /// This member variable holds a value indicating whether a user load needs changing on one or more scenarios.
        /// </summary>
        private bool loadTestScenarioChanged = false;

        /// <summary>
        /// Holds information about load scenarios and current user load of those scenarios only.
        /// </summary>
        private List<string> scenarios = new List<string>();

        /// <summary>
        /// Sets the load test running status.
        /// </summary>
        /// <param name="value">if set to <c>true</c> [value].</param>
        public void SetLoadTestRunningStatus(bool value)
        {
            this.loadTestStatus = value;
        }

        /// <summary>
        /// Gets the load test running status.
        /// </summary>
        /// <returns></returns>
        public bool GetLoadTestRunningStatus()
        {
            return this.loadTestStatus;
        }

        /// <summary>
        /// Sets the load test scenarios.
        /// </summary>
        /// <param name="values">The values.</param>
        public void SetLoadTestScenarios(List<string> values)
        {
            this.scenarios = values;
        }

        /// <summary>
        /// Gets the load test scenarios.
        /// </summary>
        /// <returns></returns>
        public List<string> GetLoadTestScenarios()
        {
            return this.scenarios;
        }

        /// <summary>
        /// Sets the scenario changed to true when there is a change in scenario's user load.
        /// </summary>
        /// <param name="value">if set to <c>true</c> [value].</param>
        public void SetScenarioChanged(bool value)
        {
            this.loadTestScenarioChanged = value;
        }

        /// <summary>
        /// Gets the scenario changed value.
        /// </summary>
        /// <returns></returns>
        public bool GetScenarioChanged()
        {
            return this.loadTestScenarioChanged;
        }
    }
}
